/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package kz.epam.sort;

import java.util.Comparator;
import kz.epam.homedevices.ElectricalDevice;

/**
 *
 * @author Knoppix
 */
public class SortByCardinality implements Comparator<ElectricalDevice> {
      
       @Override
       public int compare(ElectricalDevice obj1, ElectricalDevice obj2) {

             if(obj1.getCardinality() > obj2.getCardinality()) {
                    return 1;
             }
             else if(obj1.getCardinality() < obj2.getCardinality()) {
                    return -1;
             }
             else {
                    return 0;
             }
       }
}
